package com.model.vo;

import com.model.WordInfo;
import com.model.WordTable;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.time.LocalDate;

@Getter
@Setter
@Accessors(chain = true)
public class Word {

    private Long wordId;
    private Long tableId;
    private String word;
    private String explained;
    // 如1/421, 就是421页文章中, 会出现1次
    private String appear;
    private LocalDate date;

    public static Word create(WordInfo wordInfo, WordTable wordTable) {
        return new Word().setWord(wordInfo.getWord()).setWordId(wordInfo.getId())
                .setExplained(wordInfo.getExplained()).setAppear(wordInfo.getAppear())
                .setTableId(wordTable.getId()).setDate(wordTable.getDate());
    }

}
